<script src="../../../../vue_api_server/routes/api/private/v1/rights.js"></script>
<template>
  <div>
    <Breadcrumb :breadItemName="['权限管理','权限列表']"></Breadcrumb>
    <el-card>
      <el-table :data="rightsList" border stripe>
        <el-table-column type="index" label="#"
        ></el-table-column>
        <el-table-column label="权限名称" prop="authName"></el-table-column>
        <el-table-column label="路径" prop="path"></el-table-column>
        <el-table-column label="权限等级">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level==='0'">一级</el-tag>
            <el-tag v-else-if="scope.row.level==='1'" type="success">二级</el-tag>
            <el-tag v-else type="warning">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import Breadcrumb from '@/components/Breadcrumb'

export default {
  name: 'Rights',
  data() {
    return {
      rightsList: []
    }
  },
  created() {
    this.getRightsList()
  },
  methods: {
    async getRightsList() {
      let { data: result } = await this.$http.get('/rights/list')
      console.log(result)
      if (result.meta.status !== 200) return this.$message.error('获取用户权限失败')
      this.rightsList = result.data
    }
  },
  components: {
    Breadcrumb
  }
}
</script>

<style scoped>

</style>